<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Document</title>
</head>
<style></style>

<body style="background-color: #000">
  <div
    style="color: orange; margin: 0 auto; width: px; height: 200px;line-height: 200px;text-align: center; font-weight: 1000; font-size: 70px;">
    解构赋值
  </div>
  <script>
    //解构赋值的默认值操作，对于开发中的data数据
    let b = { m: 000 };
    let { msg: m = b } = {};
    console.log(m);
    //字符串的解構賦值
    let [...a] = 'hell';
    console.log([...a]);//["h","e","l"...]
    console.log(...a);// h e l 
    let { length } = 'hello'
    console.log(length);//5
    //函數的解構賦值
    function move({ x, y } = { x: 4, y: 9 }) {
      return [x, y]
    }
    console.log(move({ x: 3, y: 4 }));//[3,4]
    console.log(move({}));//[undefined,undefined]
    console.log(move());//[4,9]jiiin

    function ar(a = 3, b = 4) {
      return [a, b]
    }
    console.log(ar());
  </script>
</body>

</html>git